package com.basessm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
@RequestMapping("redis")
public class RedisController {
	@Autowired
	private StringRedisTemplate redisTemplate;// redis操作模板

	
	@RequestMapping("test1")
	public void  test1() {
		redisTemplate.opsForValue().set("fruit3","apple3");
		System.out.println("success1");
		
	}
	

		@RequestMapping("test2")
		public void test2() {
			redisTemplate.opsForValue().set("aliceWang","alice2");
			String a = redisTemplate.opsForValue().get("aliceWang");
			System.out.println("success2");
			System.out.println("a:" + a);
		}
}
